package com.pureut.system.service.impl;

import cn.hutool.core.bean.BeanUtil;

import com.pureut.system.domain.ProductRepairRecord;
import com.pureut.system.domain.vo.ProductRepairRecordVo;
import com.pureut.system.mapper.ProductRepairRecordMapper;
import com.pureut.system.service.IProductRepairRecordService;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import javax.annotation.Resource;
import java.util.Date;

/**
 * @Author: pureut
 * @Date: 2025-04-08 10:59:14
 * @Desc: 产品返修记录表
 */
@Service("productRepairRecordService")
public class ProductRepairRecordServiceImpl extends ServiceImpl<ProductRepairRecordMapper, ProductRepairRecord> implements IProductRepairRecordService {

    /**
     * 产品返修记录表Dao
     */
    @Resource
    private ProductRepairRecordMapper productRepairRecordMapper;




    /**
     * 新增产品返修记录表
     * @param productRepairRecordVo
     * @return
     */
    @Override
    public Boolean save(ProductRepairRecordVo productRepairRecordVo) {
        ProductRepairRecord productRepairRecord = new ProductRepairRecord();
        BeanUtil.copyProperties(productRepairRecordVo, productRepairRecord);
        productRepairRecord.setCreateTime(new Date());
        return save(productRepairRecord);
    }


    /**
     * 更新产品返修记录表
     * @param productRepairRecordVo
     * @return
     */
    @Override
    public Boolean updateById(ProductRepairRecordVo productRepairRecordVo) {
        ProductRepairRecord productRepairRecord = new ProductRepairRecord();
        BeanUtil.copyProperties(productRepairRecordVo, productRepairRecord);
        return updateById(productRepairRecord);
    }
}
